package com.dha.caodangcongnghe;

import com.dha.status.NetworkStatus;
import com.dha.ultility.QuangCao;
import com.dha.variable.ThongTinTaiKhoan;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

public class SinhVienDaDangNhap extends ActionBarActivity implements
		android.view.View.OnClickListener {
	private TextView tv_daDangNhap_sinhVien_hoTen;
	private NetworkStatus networkStatus;

	private ImageView iv_TB, iv_TKB, iv_XD, iv_DX;
	private TextView tv_TB, tv_TKB, tv_XD, tv_DX;

	// private QuangCao quangCao;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.layout_sinhvien_dadangnhap);

		iv_TB = (ImageView) findViewById(R.id.iv_TB);
		iv_TB.setOnClickListener(this);

		iv_TKB = (ImageView) findViewById(R.id.iv_TKB);
		iv_TKB.setOnClickListener(this);

		iv_XD = (ImageView) findViewById(R.id.iv_XD);
		iv_XD.setOnClickListener(this);

		iv_DX = (ImageView) findViewById(R.id.iv_DX);
		iv_DX.setOnClickListener(this);

		tv_TB = (TextView) findViewById(R.id.tv_TB);
		tv_TB.setOnClickListener(this);

		tv_TKB = (TextView) findViewById(R.id.tv_TKB);
		tv_TKB.setOnClickListener(this);

		tv_XD = (TextView) findViewById(R.id.tv_XD);
		tv_XD.setOnClickListener(this);

		tv_DX = (TextView) findViewById(R.id.tv_DX);
		tv_DX.setOnClickListener(this);

		// quangCao = new QuangCao(this, SinhVienDaDangNhap.this);

		tv_daDangNhap_sinhVien_hoTen = (TextView) findViewById(R.id.tv_daDangNhap_sinhVien_hoTen);
		tv_daDangNhap_sinhVien_hoTen.setText(ThongTinTaiKhoan.hoTen);

		networkStatus = new NetworkStatus(getBaseContext());
	}

	@Override
	public void onBackPressed() {
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.tv_DX:
		case R.id.iv_DX:
			finish();
			break;
		case R.id.iv_TB:
		case R.id.tv_TB:
			if (networkStatus.isConnected()) {
				Intent intentThongBao = new Intent(getBaseContext(),
						XemThongBao.class);
				startActivity(intentThongBao);
			} else {
				Intent intentLoi = new Intent("SuCoVeKetNoiMang");
				startActivity(intentLoi);
			}
			break;
		case R.id.tv_TKB:
		case R.id.iv_TKB:
			if (networkStatus.isConnected()) {
				Intent intentXemTKB = new Intent("XemThoiKhoaBieu");
				intentXemTKB.putExtra("MaSo", ThongTinTaiKhoan.maTaiKhoan);
				startActivity(intentXemTKB);
			} else {
				Intent intentLoi = new Intent("SuCoVeKetNoiMang");
				startActivity(intentLoi);
			}
			break;
		case R.id.tv_XD:
		case R.id.iv_XD:
			if (networkStatus.isConnected()) {
				Intent itentXemDiem = new Intent("XemDiem");
				startActivity(itentXemDiem);
			} else {
				Intent intentLoi = new Intent("SuCoVeKetNoiMang");
				startActivity(intentLoi);
			}
			break;
		}

	}

}
